<template>
	<div>
		<el-card>
			<template #header style="padding:0;">
				<div class="bc" style="height: 200px;">
					<div class="zp">
            <el-avatar :size="140" src="https://empty" @error="errorHandler">
							<img :src= StaffArchives.staffImages />
						</el-avatar>
					</div>
          <div class="js" style="top:22px;line-height:22px;color:#FFFFFF;" ><br/>
            <p style="font-size:14pt;">{{ StaffArchives.staffName }} </p><br/>
            <p>部门：{{ StaffArchives.staffDepartment }}</p>
            <p>职务：{{ StaffArchives.staffJob }} </p>
            <p>入职日期：{{ StaffArchives.staffWorkindate }}</p>
             <p>工龄：{{ StaffArchives.staffWorktime }}</p>
					</div>
				</div>
			</template>
			<div>
				<el-tabs type="border-card" style="width: 90%; margin-left: 5%">
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-tickets"></i> 基本信息</span>
						</template>
						<Information v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane>
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-date"></i> 教育经历</span>
						</template>
						<Education v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane>
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-guide"></i> 工作经历</span>
						</template>
						<Work v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane>
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-collection"></i> 员工证书</span>
						</template>
						<Certificate v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane>
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-news"></i> 福利</span>
						</template>
						<Welfare v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane>
					<el-tab-pane>
						<template #label>
							<span><i class="el-icon-thumb"></i> 权限开放</span>
						</template>
						<Jurisdiction />
					</el-tab-pane>
					<!-- <el-tab-pane>
						<template #label>
							<span><i class="el-icon-date"></i> 成长记录</span>
						</template>
						<Grow v-if="StaffArchives != ''"/>
						<div v-else class="filtering-no-data">
							<div class="no-data-box">
								<el-empty :image-size="200"></el-empty>
							</div>
						</div>
					</el-tab-pane> -->
				</el-tabs>
			</div>
		</el-card>
	</div>
</template>
<script lang="ts">
import Information from '/@/views/archives/component/information.vue';
import Education from '/@/views/archives/component/Education.vue';
import Work from '/@/views/archives/component/Work.vue';
import Certificate from '/@/views/archives/component/Certificate.vue';
import Welfare from '/@/views/archives/component/Welfare.vue';
import Salary from '/@/views/archives/component/Salary.vue';
import Grow from '/@/views/archives/component/Grow.vue';
import Jurisdiction from '/@/views/archives/component/jurisdiction.vue';
import { defineComponent, reactive, ref } from 'vue'
import { VXETable, VxeTableInstance } from 'vxe-table'
import { useStore } from '/@/store/index.ts';
import { toRefs, reactive, onMounted, nextTick, computed, getCurrentInstance } from 'vue';
import axios from 'axios';
export default {
	components: { Information, Education, Work, Welfare,Certificate,Salary,Grow,Jurisdiction},
	name: 'Personal_archives',
	setup() {
		const store = useStore();
		const state = reactive({
			form: {},
		});
		// 获取用户信息 vuex
		const getUserInfos = computed(() => {
			return store.state.userInfos.userInfos;
		});
		return {
			getUserInfos,
			...toRefs(state),
		};
	},
	data() {
		return {
			StaffArchives: '',
		};
	},
	created() {
		const loading = this.$loading({
			lock: true,
			text: '请稍等...',
			spinner: 'el-icon-loading',
			background: 'rgba(0, 0, 0, 0.7)'
		});
		setTimeout(() => {
			loading.close();
		}, 1000);

		// 设置一个间隔1s就进行的动作
		var that = this;
		axios.get('http://121.41.117.22:8081/staff-archives/staffname=' + that.getUserInfos.userName)
			.then(function (response) {
				that.StaffArchives = response.data[0];
			})
			.catch(function (err) {});
	},
};
</script>
<style lang="scss">
.bc{
	position: relative;
};
.zp{
  top:35px;
  position: absolute;
  left: 12%;
}
.js{
  position: absolute;
  left: 25%;
  color: gray;
}
.bc{
  background-color: red; /* 浏览器不支持时显示 */
  background: linear-gradient(to right,#4facfb 0%, #00f2fe 100%);
}
</style>
